<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js</title>
    <style>
        div{
            width: 50px;
            height: 50px;
            border: 1px solid;
        }
    </style>
    <script>
        // 加载整个文档后 再去执行
        window.onload = function () {
            var div= document.getElementsByTagName("div");
            console.log(div);
            var div1=document.getElementsByTagName("div")[0];
            console.log(div1);
            div1.innerHTML = "div";
            div1.style.backgroundColor = "red";
            var div2=document.getElementById("div2");
            console.log(div2);
            div2.style.backgroundColor = "green";
            var div3=document.getElementsByClassName("div3")[0];
            console.log(div3);
            div3.style.backgroundColor = "blue";
        }
    </script>
</head>
<body>
<!--        使用webstor的快捷键-->
<!--        ctrl+shift+f10-->
<!--        使用快捷键-->
<!--        注释快捷键-->
<!--            多行注释 ctrl + shift + ？-->
<!--            单行注释 ctrl + /-->
        <div >1</div>
        <div id="div2">2</div>
        <div class="div3">3</div>
</body>
</html>